<?php
// import item base
Magnum::import('utility/stack/item');
/**
 * body stacks
 * including raw and htmls, make sure
 * they are properly rendered respectively...
 * @uses Magnum_Utility_Stack_Item
 */
class Magnum_Body_Item extends Magnum_Utility_Stack_Item
{
    /**
     * overload the export function...
     * not to be used directly, as rendering won't like view vars...
     * @param bool $print if true, print
     */
    public function export($print = 1)
    {
        // if not print...
        if (!$print) {
            ob_start();
        }

        foreach ((array) $this->_items as $item) {
            // the structure should be clear as
            /**
             * ["src"]=>
             * string "path"
             * ["type"]=>
             * string "FILE" or "RAW"
             */
            // render it...
            if ($item['type'] == 'FILE') {
                include $item['src'];
            } else {
                echo $item['src'];
            }
        }

        // if not print
        if (!$print) {
            return ob_get_clean();
        }

    }// end export
}
?>